<template>
	<Tabs>
		<TabPane label="品牌信息">
			<SuperTable
				ref="table"
				path="API_GOODS_BRAND_LISTS"
				:params="params"
		    	:columns="columns"
		    >
		    	<div slot="header-left">
		    		<Button type="primary" @click="handleGoEdit()">新增商品品牌</Button>
		    	</div>
		    	<Form slot="header-right" inline @submit.native.prevent>
		            <FormItem label="关键词">
		                <Input v-model="filterForm.keywords" placeholder="请输入关键词搜索" icon="ios-search" clearable style="width: 320px;"></Input>
		            </FormItem>
		            <Button type="primary" @click="handleSearch">筛选</Button>
		    	</Form>
		    	
		    	<div slot-scope="{ row }" slot="action">
		        	<Button type="primary" size="small" @click="handleGoEdit({id: row.id})">配置</Button>
		        	<Poptip title="是否确认删除此品牌？" :width="190" placement="left" confirm transfer style="text-align: center;" @on-ok="handleDelete(row.id)">
		        		<Button type="error" size="small">删除</Button>
		        	</Poptip>
		        </div>
		    </SuperTable>
		</TabPane>
	</Tabs>
</template>

<script>
import Util from '@/libs/util.js';
import SuperTable from '@/components/SuperTable.vue';
export default {
	name: 'brandList',
	components: {
		SuperTable
	},
	data() {
		return {
			filterForm: {
				keywords: ''
			},
			params: {
				keywords: '',
				page: 1,
				limie: 10
			},
			columns: [
				{
					title: '品牌名称',
					key: 'name',
                    maxWidth: 200
				},
				{
					title: '品牌简介',
					key: 'descript'
				},
				{
					title: '品牌产品',
					key: 'number',
                    maxWidth: 120,
					align: 'center'
				},
				{
					title: '品牌检索字母',
					key: 'abc',
                    maxWidth: 120,
					align: 'center'
				},
				{
					title: '操作',
					slot: 'action',
					width: 130,
					align: 'center'
				}
			]
		}
	},
	mounted() {
		
	},
	methods: {
		// 跳转详情
		handleGoEdit(query) {
        	this.$router.push({name: 'goods_goods_brand_edit', query});
        },
		// 搜索
		handleSearch() {
			this.params.keywords = this.filterForm.keywords;
		},
		// 删除
		handleDelete(id) {
			Util.ajax.post(this.API['API_GOODS_BRAND_DESTORY'], {id: id}).then((res) => {
				this.$Message.success('删除成功');
				this.$refs.table.init();
			}).catch(() => {
				
			})
		}
	}
}
</script>